package com.example.clock;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class AboutActivity extends AppCompatActivity {
    private TextView linkQQ;
    private static String key = "xlD7SGHHIGjl_AU27qdJ3jVE47jovJeO&authKey=g1FoMgykxXaJBsyPtsCaZ6%2BalxGhOowSZT9fiqElP8RDAC5PuB%2FVHn9kD8s7vT7h&noverify=0&group_code=291451899";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);


        linkQQ = (TextView) findViewById(R.id.linkQQ);

        linkQQ.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);

        linkQQ.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                joinQQGroup(key);
            }
        });
    }

    public void joinQQGroup(String key) {
        Intent intent = new Intent();
        intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key));
        // 此Flag可根据具体产品需要自定义，如设置，则在加群界面按返回，返回手Q主界面，不设置，按返回会返回到呼起产品界面
        // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try {
            startActivity(intent);
        } catch (Exception e) {
            // 未安装手Q或安装的版本不支持
            Toast.makeText(AboutActivity.this,"未安装手Q或安装的版本不支持",Toast.LENGTH_LONG).show();
        }
    }

}